package com.mytest.interceptor;

import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * @author Wulc
 * @date 2024/4/7 17:29
 * @description
 */
public class TestInterceptor extends HandlerInterceptorAdapter {
    @Override
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
        String path = request.getServletPath();
        System.out.println("触发了url拦截器：" + path);
        return true;
//        if (path.matches("")) {
//            //不需要的拦截直接过
//            return true;
//        } else {
//            // 这写你拦截需要干的事儿，比如取缓存，SESSION，权限判断等
//            System.out.println("====================================");
//            return true;
//        }

        //return super.preHandle(request, response, handler);
    }
}
